<?php
$link=require_once 'sqlLink.php';
$id=isset($_GET['proID'])?$_GET['proID']:'';
// 删除对应文件
$filename= mysqli_fetch_assoc(mysqli_query($link,"select productPic from productinfo where productID =$id"))['productPic'];
(!file_exists($filename))?die( "文件不存在。"):'';
 (!unlink($filename))?  die("文件删除失败"):'';
//删除商品信息
$res=mysqli_query($link,"delete from productinfo where productID =$id");
if ($res) {
    header("Location: back_product_list.php");
    exit;
} else {
    echo "<script>alert('数据删除失败！');</script>";
}
